package com.gistmap.ntdc.persistence.repo;

import com.gistmap.ntdc.persistence.domain.MerchantOrder;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Lock;
import org.springframework.data.jpa.repository.Query;

import javax.persistence.LockModeType;

/**
 * @author zhangran
 * @date 2018/12/20
 */
public interface MerchantOrderRepository extends JpaRepository<MerchantOrder, Long> {

    @Lock(LockModeType.PESSIMISTIC_WRITE)
    @Query("select mo from MerchantOrder mo where mo.id=?1")
    MerchantOrder findOneWithWriteLock(Long id);
}
